import { Message } from 'element-ui'
export default function (content, text) {
  const textarea = document.createElement('textarea')
  document.body.appendChild(textarea)
  textarea.value = content
  textarea.select()
  if (document.execCommand('copy')) {
    document.execCommand('copy')
    if (text) {
      Message({
        type: 'info',
        message: text,
        duration: 1000
      })
    } else {
      Message({
        type: 'info',
        message: '复制成功',
        duration: 1000
      })
    }
  } else {
    Message({
      type: 'error',
      message: '浏览器不支持',
      duration: 1000
    })
  }
  document.body.removeChild(textarea)
}
